﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HeTuVanHuongNghiep
{
    public partial class Form1 : Form
    {
        private BindingSource bs = null;
        private DataRow currentRow = null;
        public Form1()
        {
            InitializeComponent();
        }
        private void LoadDataTruong()
        {
            // lay bang that dt
            DataTable dt = Bussiness_Layer.BTruong.SelectAll();
            //lay bang ao bs
            bs = new BindingSource();
            bs.DataSource = dt;
            //hien thi bang ao len luoi dgv
            dgv.DataSource = bs;
            XuatTruong();
        }
        private void XuatTruong()
        {
            // Lay dong dang chon:
            DataTable dt = (DataTable)bs.DataSource;
            currentRow = dt.Rows[bs.Position];
            //// Lay cell cua dong:
            Entities_Layer.ETruong truong = new Entities_Layer.ETruong(currentRow);
        }
        private void LoadDataKhoiThi()
        {
            // lay bang that dt
            DataTable dt = Bussiness_Layer.BKhoiThi.SelectAll();
            //lay bang ao bs
            bs = new BindingSource();
            bs.DataSource = dt;
            //hien thi bang ao len luoi dgv
            dgv2.DataSource = bs;
            XuaKhoiThi();
        }
        private void XuaKhoiThi()
        {
            // Lay dong dang chon:
            DataTable dt = (DataTable)bs.DataSource;
            currentRow = dt.Rows[bs.Position];
            //// Lay cell cua dong:
            Entities_Layer.EKhoiThi  khoiThi= new Entities_Layer.EKhoiThi(currentRow);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            LoadDataTruong();
            LoadDataKhoiThi();
        }
    }
}
